//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Resource Application Block
//===============================================================================

using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel.Design;
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
using Microsoft.Practices.EnterpriseLibrary.Configuration.Design;

namespace EntLibContrib.Resource.Configuration.Design.Tests
{
	public class ServiceBuilder
	{
		public static ServiceContainer Build()
		{
			ServiceContainer container = new ServiceContainer();
			NodeNameCreationService nodeNameCreationService = new NodeNameCreationService();
      ConfigurationUIHierarchyService configurationUIHierarchy = new ConfigurationUIHierarchyService();
			container.AddService(typeof(INodeNameCreationService), nodeNameCreationService);
      container.AddService(typeof(IConfigurationUIHierarchyService), configurationUIHierarchy);
			container.AddService(typeof(IUIService), new MockUIService());
			container.AddService(typeof(IErrorLogService), new ErrorLogService());
			container.AddService(typeof(INodeCreationService), new NodeCreationService());
      container.AddService(typeof(IUICommandService), new UICommandService(configurationUIHierarchy));
      container.AddService(typeof(IStorageService), new StorageService());
      container.AddService(typeof(IPluginDirectoryProvider), new AppDomainBasePluginDirectoryProvider());
			return container;
		}

    private class AppDomainBasePluginDirectoryProvider : IPluginDirectoryProvider
    {
        #region IPluginDirectoryProvider Members

        /// <summary>
        /// TODO: ADD COMMENT
        /// </summary>
        public string PluginDirectory
        {
            get { return AppDomain.CurrentDomain.BaseDirectory; }
        }

        #endregion
    }
	}
}
